import Dile_APi from "@/api";
import type { object_Inf } from "@/utils/typings/index.type";
import {
  factoryDataKeyEnum,
  factoryDataTypeEnum,
} from "@typings/factoryManage/index.type";
/*
 * @Descripttion:工厂数据类型工具类
 * @LastEditors: xzh
 * @LastEditTime: 2023-11-25 21:55:47
 */
export default class FactoryDataTypeListUtils {
  /**
   * @Author: xzh
   * @Descripttion: 工厂数据类型列
   * @Param:
   */
  static tableColumnMap: object_Inf = {
    //品质
    [factoryDataTypeEnum.quality]: [
      {
        field: "equipmentCode",
        //t('page.equipManageArr.equipArchivesArr.code')
        title: "page.equipManageArr.equipArchivesArr.code",
      },
      {
        field: "equipmentName",
        //t('page.equipManageArr.equipArchivesArr.name')
        title: "page.equipManageArr.equipArchivesArr.name",
      },
      {
        field: "orderCode",
        //t('page.factoryManageArr.factoryQualityArr.orderCode')
        title: "page.factoryManageArr.factoryQualityArr.orderCode",
      },
      {
        field: "productName",
        //t('page.systemManageArr.productArr.name')
        title: "page.systemManageArr.productArr.name",
      },
      {
        field: "checkDate",
        //t('page.factoryManageArr.factoryQualityArr.checkDate')
        title: "page.factoryManageArr.factoryQualityArr.checkDate",
        formatter: "formatDate",
      },
      {
        field: "startCheckTimes",
        //t('page.factoryManageArr.factoryQualityArr.startCheckTimes')
        title: "page.factoryManageArr.factoryQualityArr.startCheckTimes",
      },
      {
        field: "endCheckTimes",
        //t('page.factoryManageArr.factoryQualityArr.endCheckTimes')
        title: "page.factoryManageArr.factoryQualityArr.endCheckTimes",
      },
      {
        field: "inspectionQuantity",
        //t('page.factoryManageArr.factoryQualityArr.inspectionQuantity')
        title: "page.factoryManageArr.factoryQualityArr.inspectionQuantity",
      },
      {
        field: "startCheckNGNo",
        //t('page.factoryManageArr.factoryQualityArr.startCheckNGNo')
        title: "page.factoryManageArr.factoryQualityArr.startCheckNGNo",
      },
      {
        field: "endCheckNGNo",
        //t('page.factoryManageArr.factoryQualityArr.endCheckNGNo')
        title: "page.factoryManageArr.factoryQualityArr.endCheckNGNo",
      },
      {
        field: "ngNumber",
        //t('page.factoryManageArr.factoryQualityArr.ngNumber')
        title: "page.factoryManageArr.factoryQualityArr.ngNumber",
      },
      {
        field: "yieldQuantity",
        //t('page.factoryManageArr.factoryQualityArr.yieldQuantity')
        title: "page.factoryManageArr.factoryQualityArr.yieldQuantity",
      },
      {
        field: "aoiYieldRate",
        //t('page.factoryManageArr.factoryQualityArr.aoiYieldRate')
        title: "page.factoryManageArr.factoryQualityArr.aoiYieldRate",
        unit: "%",
        formatter: ({ cellValue }: object_Inf) => `${Number(cellValue) || 0}%`,
      },
    ],
    //成本数据
    [factoryDataTypeEnum.cost]: [
      {
        field: "equipmentCode",
        //t('page.equipManageArr.equipArchivesArr.code')
        title: "page.equipManageArr.equipArchivesArr.code",
      },
      {
        field: "equipmentName",
        //t('page.equipManageArr.equipArchivesArr.name')
        title: "page.equipManageArr.equipArchivesArr.name",
      },
      {
        field: "date",
        //t('page.factoryManageArr.factoryCostArr.date')
        title: "page.factoryManageArr.factoryCostArr.date",
        formatter: "formatDate",
      },
      {
        field: "classes",
        //t('page.abnormalManageArr.productQualityAbnormalArr.classes')
        title: "page.abnormalManageArr.productQualityAbnormalArr.classes",
      },
      {
        field: "equipmentStartTime",
        //t('page.factoryManageArr.factoryCostArr.equipmentStartTime')
        title: "page.factoryManageArr.factoryCostArr.equipmentStartTime",
        formatter: "formatDateTime",
      },
      {
        field: "equipmentEndTime",
        //t('page.factoryManageArr.factoryCostArr.equipmentEndTime')
        title: "page.factoryManageArr.factoryCostArr.equipmentEndTime",
        formatter: "formatDateTime",
      },
      {
        field: "actualWorkingHour",
        //t('page.factoryManageArr.factoryCostArr.realityWorkingHour')
        title: "page.factoryManageArr.factoryCostArr.realityWorkingHour",
        unit: "H",
        formatter: ({ cellValue }: object_Inf) => `${Number(cellValue) || 0}H`,
      },
      {
        field: "standardWorkingHour",
        //t('page.factoryManageArr.factoryCostArr.standardWorkingHour')
        title: "page.factoryManageArr.factoryCostArr.standardWorkingHour",
        formatter: ({ cellValue }: object_Inf) => `${Number(cellValue) || 0}H`,
        unit: "H",
      },
      {
        field: "utilizationRate",
        //t('page.factoryManageArr.factoryCostArr.utilizationRate')
        title: "page.factoryManageArr.factoryCostArr.utilizationRate",
        unit: "%",
        formatter: ({ cellValue }: object_Inf) => `${Number(cellValue) || 0}%`,
      },
    ],
    //交期
    [factoryDataTypeEnum.delivery]: [
      {
        field: "equipmentCode",
        //t('page.equipManageArr.equipArchivesArr.code')
        title: "page.equipManageArr.equipArchivesArr.code",
      },
      {
        field: "equipmentName",
        //t('page.equipManageArr.equipArchivesArr.name')
        title: "page.equipManageArr.equipArchivesArr.name",
      },
      {
        field: "date",
        //t('page.factoryManageArr.factoryDeliveryArr.date')
        title: "page.factoryManageArr.factoryDeliveryArr.date",
        formatter: "formatDate",
      },
      {
        field: "orderCode",
        //t('page.factoryManageArr.factoryQualityArr.orderCode')
        title: "page.factoryManageArr.factoryQualityArr.orderCode",
      },
      {
        field: "productName",
        //t('page.systemManageArr.productArr.name')
        title: "page.systemManageArr.productArr.name",
      },
      ///-------
      {
        field: "startMouldNumber",
        //t('page.factoryManageArr.factoryDeliveryArr.startMouldNumber')
        title: "page.factoryManageArr.factoryDeliveryArr.startMouldNumber",
      },
      {
        field: "endMouldNumber",
        //t('page.factoryManageArr.factoryDeliveryArr.endMouldNumber')
        title: "page.factoryManageArr.factoryDeliveryArr.endMouldNumber",
      },
      {
        field: "mouldTimes",
        //t('page.factoryManageArr.factoryDeliveryArr.mouldTimes')
        title: "page.factoryManageArr.factoryDeliveryArr.mouldTimes",
      },
      {
        field: "mouldCode",
        //t('page.factoryManageArr.factoryDeliveryArr.mouldCode')
        title: "page.factoryManageArr.factoryDeliveryArr.mouldCode",
      },
      {
        field: "mouldCavityNum",
        //t('page.factoryManageArr.factoryDeliveryArr.mouldCavityNum')
        title: "page.factoryManageArr.factoryDeliveryArr.mouldCavityNum",
      },
      //---
      {
        field: "startNumber",
        //t('page.factoryManageArr.factoryDeliveryArr.startNumber')
        title: "page.factoryManageArr.factoryDeliveryArr.startNumber",
      },
      {
        field: "endNumber",
        //t('page.factoryManageArr.factoryDeliveryArr.endNumber')
        title: "page.factoryManageArr.factoryDeliveryArr.endNumber",
      },
      // {
      //   field: "currentNum",
      //   //t('page.factoryManageArr.factoryDeliveryArr.currentNum')
      //   title: "page.factoryManageArr.factoryDeliveryArr.currentNum",
      // },
      {
        field: "outputQuantity",
        //t('page.factoryManageArr.factoryDeliveryArr.outputQuantity')
        title: "page.factoryManageArr.factoryDeliveryArr.outputQuantity",
      },
    ],
  };
  /**
   * @Author: xzh
   * @Descripttion: 类型过滤列
   * @Param:
   */
  static factoryTypeColumnFilter = {
    [factoryDataTypeEnum.delivery]: {
      [factoryDataKeyEnum.delivery_FORMING]: [
        "startNumber",
        "endNumber",
        "currentNum",
      ],
      [factoryDataKeyEnum.delivery_TRIM]: [
        "startNumber",
        "endNumber",
        "currentNum",
      ],
      [factoryDataKeyEnum.delivery_AOI]: [
        "startMouldNumber",
        "endMouldNumber",
        "mouldTimes",
        "mouldCode",
        "mouldCavityNum",
        "currentNum",
      ],
      [factoryDataKeyEnum.delivery_STACKING]: [
        "startMouldNumber",
        "endMouldNumber",
        "mouldTimes",
        "mouldCode",
        "mouldCavityNum",
      ],
    },
  };
}
